//
//  RestaruantNearbyDetailView.m
//  FoodFamily
//
//  Created by dlios on 15-6-25.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "RestaruantNearbyDetailView.h"

@implementation RestaruantNearbyDetailView
-(instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubView];
    }

    return self;
}
-(void)creatSubView{

      self.place_name = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11, HEIGHT / 21, WIDTH/4*3, HEIGHT/17)];
    self.place_name.backgroundColor = [UIColor clearColor];
    self.place_name.font = [UIFont systemFontOfSize:20];
    self.place_name.alpha = 0.8;
    [self addSubview:self.place_name];
    [self.place_name release];
    
    
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11,  HEIGHT / 10, WIDTH/3 *2, HEIGHT/25)];
    label2.backgroundColor = [UIColor clearColor];
    [self addSubview:label2];
    [label2 release];
    
    self.imageV1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
    self.imageV1.backgroundColor = [UIColor clearColor];
    [label2 addSubview:self.imageV1];
    [self.imageV1 release];
    
    
    self.imageV2 = [[UIImageView alloc]initWithFrame:CGRectMake(25, 0, 20, 20)];
    self.imageV2.backgroundColor = [UIColor clearColor];
    [label2 addSubview:self.imageV2];
    [self.imageV2 release];
    
    self.imageV3 = [[UIImageView alloc]initWithFrame:CGRectMake(50, 0, 20, 20)];
    self.imageV3.backgroundColor = [UIColor clearColor];
    [label2 addSubview:self.imageV3];
    [self.imageV3 release];
    
    self.imageV4 = [[UIImageView alloc]initWithFrame:CGRectMake(75, 0, 20, 20)];
    self.imageV4.backgroundColor = [UIColor clearColor];
    [label2 addSubview:self.imageV4];
    [self.imageV4 release];
    
    self.imageV5 = [[UIImageView alloc]initWithFrame:CGRectMake(100, 0, 20, 20)];
    self.imageV5.backgroundColor = [UIColor clearColor];
    [label2 addSubview:self.imageV5];
    [self.imageV5 release];

      

//    UIImageView *imageV6 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH/9, HEIGHT/21 *3, WIDTH/27, HEIGHT/36)];
    UIImageView *imageV6 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH/11, HEIGHT/21 *3, WIDTH/18, HEIGHT/32)];
    imageV6.image = [UIImage imageNamed:@"iconfont-peiziiconfont07.png"];
    [self addSubview:imageV6];
    [imageV6 release];
    

     UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11 *2,HEIGHT/21 *3, WIDTH/11 *5, HEIGHT/30)];
    label.text  = @"营业时间";
    label.alpha = 0.6;
    [self addSubview:label];
    [label release];
    

    
    self.open_time = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11 *5, HEIGHT/21 *3,  WIDTH/11 *5, HEIGHT/30)];
    self.open_time.backgroundColor = [UIColor clearColor];
    [self addSubview:self.open_time];
    self.open_time.alpha = 0.6;
    [self.open_time release];
    
   
    
    

    
     UIImageView *imageV7 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH/11, HEIGHT/22 *4, WIDTH/18, HEIGHT/30)];
    imageV7.image = [UIImage imageNamed:@"iconfont-shoucang.png"];
    [self addSubview:imageV7];
    [imageV7 release];
    
   


     self.favorites_total = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11 *2,HEIGHT/22 *4, WIDTH/11 *5, HEIGHT/30)];
    self.favorites_total.backgroundColor = [UIColor clearColor];
    [self addSubview:self.favorites_total];
    self.favorites_total.alpha = 0.6;
    [self.favorites_total release];
    
    

    UIImageView *imageV8 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH/11 *5, HEIGHT/22 *4, WIDTH/18, HEIGHT/30)];
    imageV8.image = [UIImage imageNamed:@"iconfont-iconfontordinaryliulan.png"];
    [self addSubview:imageV8];
    [imageV8 release];
    

    self.view_total = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/11 *6, HEIGHT/22 *4,  WIDTH/11 *5, HEIGHT/30)];
    self.view_total.backgroundColor = [UIColor clearColor];
    self.view_total.alpha = 0.6;
    [self addSubview:self.view_total];
    [self.view_total release];
    
    
    


    self.mapView = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH/15,HEIGHT/22 *5, WIDTH/7 *6, HEIGHT/22 *11)];
    self.mapView.backgroundColor = [UIColor clearColor];
    [self addSubview:self.mapView];
    self.mapView.image = [UIImage imageNamed:@"bg_share_large@2x.png"];
    self.mapView.userInteractionEnabled = YES;
    [self.mapView release];
    
    

//     UIImageView *imageV9 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH / 8, HEIGHT/27 *20, WIDTH/27, HEIGHT/36)];
     UIImageView *imageV9 = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH / 9, HEIGHT/27 *20, WIDTH/18, HEIGHT/32)];
    imageV9.image = [UIImage imageNamed:@"iconfont-xinxi.png"];
    [self addSubview:imageV9];

    
    
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 11 * 2,HEIGHT/15 *11,WIDTH/2, HEIGHT/22)];
    label1.backgroundColor = [UIColor clearColor];
    label1.text = @"餐馆其他信息:";
    [self addSubview:label1];
    [label1 release];
    
    

    self.tags = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 11 * 2,HEIGHT/17 *13,  WIDTH/12 *8, HEIGHT/22)];
    self.tags.backgroundColor = [UIColor clearColor];
    self.tags.font = [UIFont systemFontOfSize:14];
    self.tags.alpha = 0.7;
    [self addSubview:self.tags];
    [self.tags release];
    


      self.address = [[UILabel alloc]initWithFrame:CGRectMake(0,HEIGHT/22 *10,   WIDTH/7 *6, HEIGHT/22)];
    self.address.backgroundColor = [UIColor clearColor];
    self.address.alpha = 0.7;
    self.address.textAlignment =NSTextAlignmentCenter;
    [self.mapView addSubview:self.address];
    [self.address release];
    
    
    
}


-(void)setDic:(NSMutableDictionary *)dic{

    self.place_name.text = [dic objectForKey:@"place_name"];
    
    self.open_time.text = [dic objectForKey:@"open_time"];
   
    
    self.favorites_total.text =  [NSString stringWithFormat:@"被%@次收藏",[dic objectForKey:@"favorites_total"]];
    
   
    self.view_total.text = [NSString stringWithFormat:@"浏览%@次",[dic objectForKey:@"view_total"]];
    
    self.tags.text = [dic objectForKey:@"tags"];
    
    self.address.text = [dic objectForKey:@"address"];
    
    float num1 = [[dic objectForKey:@"star"]floatValue];

    
    if (num1 == 0.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        
    }if (num1 == 0.5) {
        
        self.imageV1.image = [UIImage imageNamed:@"iconfont-xingxingbanke.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        
    }if (num1 == 1.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
    }if (num1 == 1.5) {
        
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-xingxingbanke.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        
    }if (num1 == 2.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
    }if (num1 == 2.5) {
        
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-xingxingbanke.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        
    }if (num1 == 3.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        
    }if (num1 == 3.5) {
        
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-xingxingbanke.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
    }if (num1 == 4.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
    }if (num1 == 4.5) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-xingxingbanke.png"];
    }if (num1 == 5.0) {
        self.imageV1.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV2.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV3.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV4.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
        self.imageV5.image = [UIImage imageNamed:@"iconfont-shaidanpingjia.png"];
    }
    

    
    
    

}
-(void)dealloc{
    [_place_name release];
    [_dic release];
    [_imageV1 release];
    [_imageV2 release];
    [_imageV3 release];
    [_imageV4 release];
    [_imageV5 release];
    [_open_time release];
    [_favorites_total release];
    [_view_total release];
    [_mapView release];
    [_tags release];
    [_address release];
    [super dealloc];

}

@end
